Eclipse Platform
Pre-release 3.0

org.eclipse.team.core.sync
Class RemoteContentsCache

java.lang.Object
  extended byorg.eclipse.team.core.sync.RemoteContentsCache

public class RemoteContentsCache
extends Object

This class implements a caching facility that can be used by TeamProviders to cache contents


Method Summary
static void disableCache(String cacheId)
          Disable the cache, dispoing of any file contents in the cache.
static void enableCaching(String cacheId)
          Enables the use of remote contents caching for the given cacheId.
static RemoteContentsCache getCache(String cacheId)
          Return the cache for the given id or null if caching is not enabled for the given id.
 RemoteContentsCacheEntry getCacheEntry(String id)
           
protected  IPath getCachePath()
           
protected  ILock getLock()
          Provide access to the lock for the cache.
 String getName()
           
 boolean hasEntry(String id)
          Return whether the cache contains an entry for the given id.
static boolean isCachingEnabled(String cacheId)
          Returns whether caching has been enabled for the given Id.
protected  void purgeFromCache(RemoteContentsCacheEntry entry)
          Purge the given cache entry from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

enableCaching

public static void enableCaching(String cacheId)
Enables the use of remote contents caching for the given cacheId. The cache ID must be unique. A good candidate for this ID is the plugin ID of the plugin peforming the caching.

Parameters:
cacheId - the unique Id of the cache being enabled
Throws:
TeamException - if the cache area on disk could not be properly initialized

isCachingEnabled

public static boolean isCachingEnabled(String cacheId)
Returns whether caching has been enabled for the given Id. A cache should only be enabled once. It is conceivable that a cache be persisted over workbench invocations thus leading to a cahce that is enabled on startup without intervention by the owning plugin.

Parameters:
cacheId - the unique Id of the cache
Returns:
true if caching for the given Id is enabled

disableCache

public static void disableCache(String cacheId)
Disable the cache, dispoing of any file contents in the cache.

Parameters:
cacheId - the unique Id of the cache
Throws:
TeamException - if the cached contents could not be deleted from disk

getCache

public static RemoteContentsCache getCache(String cacheId)
Return the cache for the given id or null if caching is not enabled for the given id.

Parameters:
cacheId -
Returns:

hasEntry

public boolean hasEntry(String id)
Return whether the cache contains an entry for the given id. Register a hit if it does.

Parameters:
id - the id of the cache entry
Returns:
true if there are contents cached for the id

getCachePath

protected IPath getCachePath()

purgeFromCache

protected void purgeFromCache(RemoteContentsCacheEntry entry)
Purge the given cache entry from the cache. This method should only be invoked from an instance of RemoteContentsCacheEntry after it has set it's state to DISPOSED.

Parameters:
entry -

getCacheEntry

public RemoteContentsCacheEntry getCacheEntry(String id)
Parameters:
id - the id that uniquely identifes the remote resource that is cached.
Returns:

getName

public String getName()

getLock

protected ILock getLock()
Provide access to the lock for the cache. This method should only be used by a cache entry.

Returns:
Returns the lock.

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.